<?set_time_limit(300);
ob_start(); 
include_once("../common/header.html");
include_once('../common/autoload.php');
include_once("../class/ProOrder_dev.php");
$out_html = ob_get_contents();
ob_end_clean();
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$soap = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));


$memberID = $_SESSION['sid'];
if ($memberID!=1) exit('Access Denied!');

$btime=$_REQUEST['begintime']?$_REQUEST['begintime']:date("Y-m-d");
$etime=$_REQUEST['endtime']?$_REQUEST['endtime']:date("Y-m-d");
$by=$_REQUEST['by']?$_REQUEST['by']:"lid";
$option=array();
if(count($_REQUEST['status'])>0){
	$option['status']=implode("|",$_REQUEST['status']);
}

// 景点查询
if(isset($_REQUEST['landid']))	$option['lid'] = $_REQUEST['landid'];

// 门票查询
if(isset($_REQUEST['ticket'])){
	$t = explode("_",$_REQUEST['ticket']);$option['tid']=$t[0];
}

//交易时间类型
$timeType = isset($_REQUEST['time_type'])? abs($_REQUEST['time_type']) : 1;
//分销商ID
$fid = isset($_REQUEST['fid']) ? abs($_REQUEST['fid']) : 0;
$aid = isset($_REQUEST['aid']) ? abs($_REQUEST['aid']) : 0;
//TODO::直销
$option['n'] = 100;
$obj = new AdminProOrder($memberID, $soap);





//会员数据
$aDistorsNames = include '../module/link_product/Member.cache.php';

$r = $obj->_orderSum($btime." 00:00:00",$etime." 23:59:59",$by,$option, $timeType, $fid, $aid);

// exit;
if($_GET['by']=='mid' || $_GET['by']=='aid'){
    foreach($r as $k => $v){
        if($_SESSION['memberID']==1 && $_SESSION['dtype']==9){
            $r[$k]['title']=$aDistorsNames[$k];
        }else{
            $r[$k]['title']=$memberNames[$k];
        }
    }
}


$titleT=array("lid"=>"景区名称","tid"=>"票类名称","mid"=>"分销商名称");
$totals=array();
/*导出EXCEL处理程序--begin-*/
include("../ExcelHandle.php");
/*导出EXCEL处理程序--end*/
echo $out_html;
$from="sale";
// 获取产品
$products = array(); //系统中的所有在售产品
include("orderReport.tpl");
include("../common/footer.html");
?>